package com.xiaoxin.demo01.controller;

import com.xiaoxin.common.entity.CommonEntity;
import com.xiaoxin.common.utils.YuUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RequestMapping("/user")
@RestController
@Slf4j
public class UserController {
    @GetMapping("/localHello")
    public String localHello() {
        String result = "Hello Yiu";
        log.info("你的输出结果->{}", result);
        return result;
    }

    @GetMapping("/hello")
    public String sayHello() {
        String result = "Hello Yiu";
        YuUtil.sayError(result);
        log.info("你的输出结果->{}", result);
        return result;
    }

    @GetMapping("/getObject")
    public CommonEntity getObject() {
        CommonEntity result = new CommonEntity();
        result.setId(123L);
        result.setCreatDate(new Date());
        result.setEndDate(new Date());
        return result;
    }

}
